#ifndef __SENDSIGNAL_H__
#define __SENDSIGNAL_H__


#include "std_def.h"
#include "neuron.h"


class sendsignal
{
  public:
    sendsignal();
    virtual ~sendsignal();

/**
 * set neuronet
 * neuron* - pointer to the neuron array [neuronet]
 * int     - size of neuron array [neuronet]
 */
    void setneuronet(neuron *, ntype::neuroncount_t);

/**
 * send signal.
 * double* - pointer to the neuro net
 * int     - neuron count in the array
 */
    virtual void send(double*, int size) = 0;

/**
 * set neuron count in layer
 * int - neuron count in layer
 */
    void setlayersize(ntype::layerid_t size);

/**
 * get neuron count in layer
 */
    ntype::layerid_t getlayersize();

/**
  get neuron id for selected layer and selected cell.
  layerid and pos_in_layer MUST are start from 0[zero]
 */
    ntype::neuronid_t getneuronid(ntype::layerid_t layer, ntype::neuroncount_t pos_in_layer);
/**
  get start neuron id for selected layer.
  layerid MUST be start from 0[zero]
 */
    ntype::neuronid_t getstartneuronidforlayer(const ntype::layerid_t layerid);

/**
 * get pointer to the neuron by ID
 */
    neuron* getneuron(ntype::neuronid_t id) const{
      return (id < neuron_count) ? const_cast<neuron*>(&p_neuron[id]) : null;
    }

    virtual ntype::error_t geterror(const ntype::signal_t *);

    void setminvalue(double v);
    double getminvalue();

  protected:
    virtual void init();

    ntype::layerid_t getlayercountmax();

    neuron              *p_neuron;
    ntype::neuroncount_t neuron_count;
    ntype::neuroncount_t layersize;
    double               m_min_value;

  private:
};

#endif // __SENDSIGNAL_H__
